/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package opener;

import java.nio.file.Path;
import org.apache.commons.io.FilenameUtils;

/**
 *
 * @author asus
 */
public abstract class GeneralOpener {

    protected String filepath;
    protected String filetype;

    public GeneralOpener(String filepath) {
        this.filepath = filepath;
        this.filetype = getfiletype(filepath);
    }

    public abstract double[][] getdata();

    public abstract double[] gettimedelay();

    public abstract double[] getwavelength();

    /**
     *
     * @param filepath String
     * @return file type
     */
    public final String getfiletype(String filepath) {
        String type = "";
        String var = FilenameUtils.getExtension(filepath);
        if ("dat".equals(var)) {
            type = "gedas";
        }
        if ("img".equals(var)) {
            type = "streak";
        }
        if ("txt".equals(var)) {
            type = "txt";
        }
        if ("csv".equals(var)) {
            var = "csv";
        }

        return type;
    }

    public final String getfilepath() {
        return filepath;
    }
}
